package com.app.ui.ui2;

import java.awt.Color;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Hashtable;
import java.util.Map;
import org.jgraph.graph.DefaultGraphCell;
import org.jgraph.graph.DefaultPort;
import org.jgraph.graph.GraphConstants;

public class mPoint {
	
	DefaultGraphCell point;
	DefaultPort port1;
	DefaultPort port2;
	DefaultPort port3;
	DefaultPort port4;
	Map<Object, Object> pointAtt;
	Map<Object, Object> port1Att;
	Map<Object, Object> port2Att;
	Map<Object, Object> port3Att;
	Map<Object, Object> port4Att;
	
	mPoint(String name , int num_x , int num_y){
	    
		double x = 200.0* (num_x) ;
		double y = 100.0* num_y;
	    
	    point = new DefaultGraphCell(name);
	    pointAtt = new Hashtable<Object, Object>();
	    Rectangle2D pointbound = new Rectangle2D.Double(x, y, 200, 50);
	    GraphConstants.setBounds(pointAtt, pointbound);
	    GraphConstants.setBorderColor(pointAtt, Color.black);
	    
	    port1 = new DefaultPort();
	    port1Att = new Hashtable<Object, Object>();
	    Point2D position1 = new Point2D.Double(GraphConstants.PERMILLE/2,0);
	    GraphConstants.setOffset(port1Att, position1);
	    
	    port2 = new DefaultPort();
	    port2Att = new Hashtable<Object, Object>();
	    Point2D position2 = new Point2D.Double(GraphConstants.PERMILLE/2,GraphConstants.PERMILLE);
	    GraphConstants.setOffset(port2Att, position2);
	    
	    port3 = new DefaultPort();
	    port3Att = new Hashtable<Object, Object>();
	    Point2D position3 = new Point2D.Double(0,GraphConstants.PERMILLE/2);
	    GraphConstants.setOffset(port3Att, position3);
	    
	    port4 = new DefaultPort();
	    port4Att = new Hashtable<Object, Object>();
	    Point2D position4 = new Point2D.Double(GraphConstants.PERMILLE/2,GraphConstants.PERMILLE);
	    GraphConstants.setOffset(port4Att, position4);
	    
	    point.add(port1);
	    point.add(port2);
	    point.add(port3);
	    point.add(port4);
	    
	}
	
	public DefaultGraphCell getPoint(){
		
		return point;
	}
	
	public DefaultPort getPort1(){
		
		return port1;
	}
	
    public DefaultPort getPort2(){
		
		return port2;
	}
    
    public DefaultPort getPort3(){
		
		return port3;
	}
    
    public DefaultPort getPort4(){
		
		return port4;
	}
    
    public Map<Object, Object> getPointAtt(){
    	
    	return pointAtt;
    }
    
    public Map<Object, Object> getPort1tAtt(){
    	
    	return port1Att;
    }

    public Map<Object, Object> getPort2tAtt(){
    	
    	return port2Att;
    }
    
    public Map<Object, Object> getPort3tAtt(){
    	
    	return port3Att;
    }
    
    public Map<Object, Object> getPort4tAtt(){
    	
    	return port4Att;
    }
}
